<?php

class RegisterController {

    public $page_title;
/* ------------------------------------------------------------------------------------------------- */


    public function __construct() {
        include '../icloud_files/models/UserModel.php';
        $user_model = new UserModel();
        $user_model->page_title = 'Register';
        $user_model->get_states();

        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            $user_model->register_user($_POST, $_FILES);
            if(isset($user_model->success) && $user_model->success) {
                $user_model->page_title = 'Login';
                View::get_instance()->render('login', $user_model);
                exit;
            }
        }

        View::get_instance()->render('register', $user_model);
    }
/* ------------------------------------------------------------------------------------------------- */

}
